package com.runfast.waimai.web.controller;

import com.runfast.common.web.entity.Result;
import com.runfast.pay.Channel;
import com.runfast.pay.RefundType;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * 外卖支付接口
 */
@RestController("userWmPayController")
@RequestMapping(value= "/api/user/wm/pay", headers = "token")
public class PayController {

    /**
     * 获取支付宝或微信预支付信息
     * @param channel 支付渠道
     * @param orderNo 订单号
     * @param request
     * @return
     */
    @PostMapping("prepay")
    public Result<String> prepay(@RequestParam Channel channel, @RequestParam String orderNo, HttpServletRequest request) {
        return Result.ok("");
    }


    /**
     * 查询订单状态
     * @param orderNo 订单号
     * @return
     */
    @PostMapping("orderQuery")
    public Result orderQuery(@RequestParam String orderNo) {
        return Result.ok("");
    }


    /**
     * 退款查询
     * @param orderNo 订单号
     * @return
     */
    @PostMapping("refundQuery")
    public Result refundQuery(@RequestParam String orderNo) {
        return Result.ok("");
    }

    /**
     * 申请退款
     * @param orderNo 订单号
     * @param reason 退款原因
     * @param refundType 退款类型（全额，部分）
     * @param refundAmount 退款金额
     * @return
     */
    @PostMapping("applyRefund")
    public Result applyRefund(@RequestParam String orderNo, @RequestParam String reason, @RequestParam RefundType refundType, @RequestParam int refundAmount) {
        return Result.ok("");
    }

}
